<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box > div{
            height: 200px;
            width: 200px;
        }
        .box1{
            background-color: green;
        }
        .box2{
            background-color: pink;
            position: sticky;
            left: 500px;
        }
        .box3{
            background-color: yellow;
        }
    </style>
    <!-- 
    position:static 默认值
    position:absolute 绝对定位 脱离文档流
    position:relative 相对定位
    position:fixed 固定定位 脱离文档流
    position:sticky  粘性定位-->
</head>
<body>
    <div class="box">
        <div class="box1"></div>
        <div class="box2"></div>
        <div class="box3"></div>
    </div>
</body>
</html>